﻿namespace JxcLite.Repositories;

class BaseDataRepository
{
    internal static async Task<bool> ExistsGoodsCodeAsync(Database db, JxGoods model)
    {
        var sql = "select count(*) from JxGoods where Id<>@Id and Code=@Code";
        return await db.ScalarAsync<int>(sql, new { model.Id, model.Code }) > 0;
    }

    internal static async Task<bool> ExistsPartnerNameAsync(Database db, JxPartner model)
    {
        var sql = "select count(*) from JxPartner where Id<>@Id and Name=@Name";
        return await db.ScalarAsync<int>(sql, new { model.Id, model.Name }) > 0;
    }
}